package core.utils;


import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 *
 * @description:
 * @remarks:
 * @author Long
 * @date 2021/3/6 9:32
 * @return
 */
public class IPUtil {



    public static String getServerIp(){
        try {
            return InetAddress.getLocalHost().getHostAddress();
        } catch (UnknownHostException e) {
            return "unknown IP";
        }
    }

    public static String getServerDevice() {
        try {
            // 获取服务器计算机名
            return InetAddress.getLocalHost().getHostName();
        } catch (UnknownHostException e) {
            return  "unknown device.";
        }
    }
}
